package com.cedric.yixianpai.game.cards.Sects.swordCards.a_LianQi;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 护身灵气
 */
@Component
public class HuShenLingQi extends SwordCard {
    protected int spiritAdd;

    /**
     * 护身灵气 5盾+1/2/3灵气
     * @param lvl 1/2/3
     */
    public HuShenLingQi(@Value("1") int lvl){
        super("护身灵气");
        this.setLevel(lvl);
        this.setPeriod(Period.LIANQI);
        this.setDescription("+5护盾 +1/2/3灵气");

        this.setShield(5);
        if(1==lvl){
            this.spiritAdd=1;
        } else if (2==lvl) {
            this.spiritAdd=2;
        } else if (3==lvl) {
            this.spiritAdd=3;
        }else {
            throw new RuntimeException("错误的卡牌等级！");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.getPlayerBuff().addSpiritualEnergy(this.spiritAdd);
        Sta1.getPlayerBuff().addShield(this.getShield());
        return true;
    }
}
